package com.woniuxy.trade.mapper;

import com.woniuxy.trade.entity.Room;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.math.BigDecimal;

public interface RoomMapper extends Mapper<Room> {
    @Update("update room set currprice = #{currprice},ownerid = #{userid} where id = #{roomid} and #{currprice} > IFNULL((select currprice where id = #{roomid}),0)")
    void updateRoomByCons(@Param("roomid") Integer roomid, @Param("currprice") BigDecimal currprice,@Param("userid") Integer userid);
}